/*
*注册
*/
<<<<<<< HEAD
$(function(){
	var spwd = 0;
	var srepwd = 0;
	var snumber = 0;
	//用户名
	$("#zc-name").blur(function(){	
		$.post(
			"/index/request/name",
			{name:$("#zc-name").val()},
			function nameFunc(data)
			{
				if (data == '2'){
					$('.zc-name').empty() ;
					$('.zc-name').append("用户名已存在") ;
				} else if(data == '0'){
					sname = 0;
					$('.zc-name').empty() ;
					$('.zc-name').append("用户名不能为空") ;
				}else{
					$('.zc-name').empty() ;
				};
			}
		)
	});

	//密码
	$("#zc-pwd").blur(function(){
		var pwd = $("#zc-pwd").val()
		if(pwd.length<6){
			$('.zc-pwd').empty();
			spwd=0;
			$('.zc-pwd').append('密码不能小于6位');
		} else{
			spwd=1;
			$('.zc-pwd').empty();
		}
	});
	//确认密码
	$('#zc-repwd').blur(function(){
		var repwd = $('#zc-repwd').val();
		var pwd = $('#zc-pwd').val();
		if (pwd == repwd){
			srepwd=1;
			$('.zc-repwd').empty();
		} else {
			srepwd=0;
			$('.zc-repwd').empty()
			$('.zc-repwd').append('密码不一致');
		}
	});
	//邮箱
	$('#zc-email').blur(function(){
		$.post(
			"/index/request/email",
			{
				email:$('#zc-email').val()
			},
			function(data){
				console.log(data);
				if(data=='buzai1') {
					$('.zc-email').empty();
					$('.zc-email').append();
				} else if(data=='cunzai1'){
					$('.zc-email').empty();
					$('.zc-email').append('该邮箱已注册');
				} else {
					$('.zc-email').empty();
					$('.zc-email').append('邮箱格式不正确');
				}
			}	
		);
	});
	//手机号
	$('#zc-number').blur(function(){
		var number = $('#zc-number').val();
		if(!(/^1(3|4|5|8)[0-9]\d{4,8}$/.test(number))){ 
			snumber=0;
       		$('.zc-number').empty();
			$('.zc-number').append('手机号不正确'); 
    	} else{
    		$.post(
			"/index/request/number",
			{
				number:$('#zc-number').val()
			},
			function(data){
				if (data==false){
					$('.zc-number').empty();
					$('.zc-number').append('该号码已存在');
				} else {
					$('.zc-number').empty();
				}
			}	
			);
    		snumber=1;
			$('.zc-number').empty();
		}
	});
	//提交注册信息
	$('#zc-zhuce').click(function(){
		$.post(
			"/index/request/zhuce",
			{
				name:$("#zc-name").val(),
				pwd:$("#zc-pwd").val(),
				email:$('#zc-email').val(),
				number:$('#zc-number').val(),
				spwd:spwd,
				srepwd:srepwd,
				snumber:snumber,
			},
			function(data){
				if (data=="true") {
					window.location.href = "/index/index/notice?status=注册成功&url='__WEB_SITE__/index/index/index";
				} else {
					window.location.href = "/index/index/notice?status=注册失败&url='__WEB_SITE__/index/user/enter";
				}
			}
		);
	});
});
/*
*登录
*/
$(function(){
	//填写用户名/电话/email
	$('#dl-num').blur(function(){
		$.post(
			"/index/request/num",
			{
				num:$('#dl-num').val(),
			},
			function(data){
				console.log(data);
				if(data == 0){
					$('.dl-num').empty();
					$('.dl-num').append('该用户不存在，请注册');
				}else if (data==1){
					$('.dl-num').empty();
				}else{
					$('.dl-num').empty();
				}
			}
		);
	});	
	
	//密码验证
	$('#dl-pwd').blur(function(){
		$.post(
			"/index/request/dlpwd",
			{
				dlpwd:$('#dl-pwd').val(),
				num:$('#dl-num').val(),
			},
			function(data){
				if(data == false){
					$('.dl-pwd').empty();
					$('.dl-pwd').append('密码不正确');
				}else if (typeof(data)=='number'){
					$('.dl-pwd').empty();
				}else{
					$('.dl-pwd').empty();
					$('#dl-pwd').attr('value',data);
				}
			}
		);
	});	
	//记住密码
	var sta = 1;
	var ji = 0;
	$('#dl-jizhu').click(function(){
		++sta;
		if(sta%2==0){
			ji = 1;
		} else{
			ji = 0;
		}
	});
	//登录
	$('#dl-denglu').click(function(){
		$.post(
			"/index/request/denglu",
			{
				dlpwd:$('#dl-pwd').val(),
				num:$('#dl-num').val(),
				ji:ji,
			},
			function(data){
				if(data == false){
					window.location.href = "/index/index/notice?status=登录失败&url='__WEB_SITE__/index/user/enter";
				}else{
					window.location.href = "/index/index/notice?status=登录成功&url='__WEB_SITE__/index/index/index";
				}
			}
		);
	});
	
});
=======


$(function(){
	console.log(2);
	//用户名
	$("#zc-name").blur(function(){	
		$.ajax({
			type:"POST",
			url:"http://www.grm.com/index/request/name",
			data:{name:$("#zc-name").val()},
			success:function nameFunc(data)
			{
				if (data == 'true'){
					$('.zc-name').empty() ;
					$('.zc-name').append("用户名已存在") ;
				}else{
					$('.zc-name').empty() ;
				}
			}
		})
	});
	//密码
	$("#zc-pwd").blur(function(){
		$.ajax({
			type:"POST",
			url:"http://www.grm.com/index/request/pwd",
			data:{
				pwd:$("#zc-pwd").val()
			},
			success:function(data){
				 if(data){
					$('.zc-pwd').empty();
					$('.zc-pwd').append('密码不能小于6位');
				} else{
					$('.zc-pwd').empty();
				}
			}
		});
	});
	$('#zc-pwd')
	//确认密码
	$('#zc-repwd').blur(function(){
		$.ajax({
			type:'POST',
			url:"http://www.grm.com/index/request/repwd",
			data:{
				repwd:$('#zc-repwd').val(),
				pwd:$('#zc-pwd').val(),
			},
			success:function(data){
				if(data=='false'){
					$('.zc-repwd').empty()
					$('.zc-repwd').append('密码不一致');
				} else {
					$('.zc-repwd').empty();
				}
			}
		});
	});
	//邮箱
	$('#zc-email').blur(function(){
		$.ajax({
			type:'POST',
			url:"http://www.grm.com/index/request/email",
			data:{
				email:$('#zc-email').val()
			},
			success:function(data){
				if (data){
					$('.zc-email').empty();
					$('.zc-email').append('邮箱格式不正确');
				} else {
					$('.zc-email').empty();
				}
			}
		});
	});
	//手机号
	$('#zc-number').blur(function(){
		$.ajax({
			type:'POST',
			url:"http://www.grm.com/index/request/number",
			data:{
				number:$('#zc-number').val()
			},
			success:function(data){
				console.log(data);
			}
		});
	});

});
>>>>>>> 30d92055e9c414d4b857afd0613e979a055c3b0c
